package com.whq.mvc.base.designpattern.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * 学校节点
 */
public class University extends OrganizationComponent{

    List<OrganizationComponent> organizationComponents = new ArrayList<>();

    public University(String name, String desc) {
        super(name, desc);
    }

    @Override
    protected void add(OrganizationComponent organizationComponent) {
        organizationComponents.add(organizationComponent);
    }

    @Override
    protected void remove(OrganizationComponent organizationComponent) {
        organizationComponents.remove(organizationComponent);
    }

    @Override
    public void print() {
        System.out.println("-----------------"+getName()+"*"+getDesc()+"-----------------");
        organizationComponents.forEach(x -> {
            x.print();
        });
    }
}
